import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
//aaa
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'app',
      component: () => import('../components/Main.vue'),
      redirect: {path:'/home'},
      children: [
        {
          path: 'home',
          name:'home',
          component: () => import('../views/Home.vue'),
        },
        {
          path: 'homeview',
          name: 'homeview',
          component: HomeView
        },
        {
          path: 'myorder',
          name: 'myorder',
          component: () => import('../views/MyOrder.vue')
        },
        {
          path: 'personalcenter',
          name: 'personalcenter',
          component: () => import('../views/PersonalCenter.vue')
        },
        {
          path: 'comdetail',
          name: 'comdetail',
          component: () => import('../views/ComDetail.vue')
        },
        {
          path: 'car',
          name: 'car',
          component: () => import('../views/Car.vue')
        },
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login.vue')
    },
    
    {
      path: '/registration',
      name: 'registration',
      component: () => import('../views/Registration.vue')
    },
    
    {
      path: '/:pathMatch(.*)',
      name: 'notfound',
      component:() => import('../views/NotFound.vue'),
      meta: { title: '404' }
    }

  ]
})

export default router
